home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
util
/
rexx
/
xdmd1.lha
/
MultiFiles.xdme
< prev
next >
Wrap
Text File
|
1994-10-29
|
5KB
|
162 lines
/* MultiFiles.dme: Uses the ReqTools File Requester to delete, crunch,
decrunch, copy, move, print, or load multiple files */
/* Copyright © 1994 Fergus Duniho */
if ~show("L","rexxreqtools.library") then
if ~addlib("rexxreqtools.library",0,-30) then exit
if ~show("L","rexxarplib.library") then
if ~addlib("rexxarplib.library",0,-30) then exit
parse arg com .
select
when com = "ViewArc" then do
hailstr = "Select Archives to View"
oktext = "_View"
end
when com = "Unarchive" then do
hailstr = "Select Archives to Extract"
oktext = "_Extract"
end
otherwise do
hailstr = "Select Files to" com
oktext = "_" || com
end
end
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_multiselect|freqf_patgad"
if com = "Delete" then tagstr = tagstr || "|freqf_selectdirs|freqf_save"
address 'XDME.1'
options results
'rxresult $path'
P = result
'rxresult $fname'
N = result
if com = "ViewArc" | com = "Unarchive" then do
P = "Misc:Archives"
N = ""
end
call rtfilerequest(P,N,hailstr,oktext,tagstr,files)
If files = 0 Then Exit
Select
When com = "Delete" Then Do X = 1 to files.count
Call Remove files.X
End
When com = "Unpack" Then Do X = 1 to files.count
C = 'xpack "' || files.X || '"'
Say "Unpacking" files.X "..."
Address Command C
End
When com = "Copy" | com = "Move" Then Do
if files.count = 1 then do
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_patgad"
dest = rtfilerequest(P,N,"Select Destination",,tagstr)
end
else do
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_nofiles"
dest = rtfilerequest(P,,"Select Destination",,tagstr)
end
if rtresult = 1 then do
do X = 1 to files.count
C = com '"' || files.X || '" "' || dest || '"'
Say C
Address Command C
End
End
End
When com = "Print" Then Do
D = Request(22,19,"Select Destination", "PRT:", " Print ", " Cancel ")
If D ~= "" Then Do
Do X = 1 to files.count
C = 'Type "' || files.X || '" to "' || D || '"'
Say C
Address Command C
End
End
End
When com = "Run" Then Do X = 1 to files.count
C = 'runback "' || files.X || '"'
Say C
Address Command C
End
When com = "Load" Then Do
PL = Lastpos("/", files.1) /* PL means Length of Path Name */
If PL = 0 Then PL = Lastpos(":", files.1)
Do X = 1 to files.count
N = delstr(files.X, 1, PL)
C = "newwindow newfile (" || files.X || ") menuadd Window ("
C = C || N || ") (select (window=" || N || "))"
C
call Mode(files.X)
End
End
When com = "Unarchive" Then Do
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_nofiles|freqf_save"
dest = rtfilerequest(P,,"Select Destination",,tagstr)
if rtresult = 1 then do
do X = 1 to files.count
tail = upper(right(files.X, 3))
select
when tail = "LHA" | tail = "LZH" | tail = "RUN" then
unarc = 'tools:compression/lha -m -a x "' || files.X || '"' '"' || dest || '"'
when tail = "ZIP" then
unarc = 'tools:compression/unzip -o "' || files.X || '"'
when tail = "ZOO" then
unarc = 'tools:compression/zoo x./ "' || files.X || '"'
otherwise iterate
end
Say unarc
Address Command unarc
End
End
End
When com = "ViewArc" Then Do
Call Delete 'T:Archives'
Do X = 1 to files.count
tail = upper(right(files.X, 3))
select
when tail = "LHA" | tail = "LZH" | tail = "RUN" then
view = 'tools:compression/lha >>T:Archives v'
when tail = "ZIP" then
view = 'tools:compression/unzip >>T:Archives -v'
when tail = "ZOO" then
view = 'tools:compression/zoo >>T:Archives -list'
otherwise iterate
end
C = 'execute (' || view '"' || files.X || '")'
C
End
'execute (C:runback SYS:Utilities/Most T:Archives)'
End
Otherwise Do X = 1 to files.count
C = 'xpack "' || files.X || '" method' com
Say "Packing" files.X "with" com "compression ..."
Address Command C
End
End
Exit
Remove: Procedure
parse arg fname
if word(statef(fname), 1) = "DIR" then do
call filelist(Pattern(fname), files, , "E")
do x = 1 to files.0
Call Remove files.x
end
end
Say "Deleting" fname "..."
call delete fname
call delete fname || ".info"
return
Pattern: Procedure
parse arg dir
if right(dir, 1) ~= ":" then
pat = dir || "/*"
else
pat = dir || "*"
return pat